package tictactoe;

/**
 *
 * @version 1
 * @author Home
 */
public class Player {

    /**
     *
     */
    public static final int TYPE_COMPUTER = 1;

    /**
     *
     */
    public static final int TYPE_HUMAN = 0;

    /**
     *
     */
    public static final int TYPE_REMOTE = 2;
    private String          name;
    private int             type;

    /**
     *
     * @param name
     */
    public Player(String name) {
        this(name, TYPE_HUMAN);
    }

    /**
     *
     * @param name
     * @param type
     */
    public Player(String name, int type) {
        this.name = name;
        this.type = type;
    }

    /**
     *
     * @return
     */
    public String getName() {
        return name;
    }

    /**
     *
     * @return
     */
    public int getType() {
        return type;
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }

        if (getClass() != obj.getClass()) {
            return false;
        }

        final Player other = (Player) obj;

        if ((this.name == null)
            ? (other.name != null)
            : !this.name.equals(other.name)) {
            return false;
        }

        return true;
    }

    @Override
    public int hashCode() {
        int hash = 7;

        hash = 37 * hash + ((this.name != null)
                            ? this.name.hashCode()
                            : 0);

        return hash;
    }
}


//~ Formatted by Jindent --- http://www.jindent.com
